package com.kkwrite.regimen.provider.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.kkwrite.regimen.provider.domain.RegShopItemDO;
import com.kkwrite.regimen.provider.domain.RegShopItemPK;

/** 
 * 店铺项目关系表
 *
 * @author Soosky Wang
 * @date 2018年7月25日 下午9:04:19 
 * @version 1.0.0
 */
public interface RegShopItemRepository extends JpaRepository<RegShopItemDO, RegShopItemPK> {

	/**
	 * 根据项目id 统计店面数量
	 * @param itemId
	 * @return Integer
	 */
	/*@Query(value="select count(*) from RegShopItemDO t left join RegShop t2 on t1.shopId=t2.shopId  where t1.itemId = :itemId and t2.city= :city", nativeQuery=true)*/
	@Query(value="select count(*) from reg_shop_item t where t.item_id = :itemId", nativeQuery=true)
    Integer countShopByItemId(@Param("itemId") Long itemId,@Param("itemId") String city);
	List<RegShopItemDO>  findAllByItemId(Long itemId);
	
}
